package chpt03;
import java.text.DecimalFormat;
import java.util.Scanner;

class Person4 {
	private String name;
	private int age;
	private boolean gender;

	public Person4(String name, int age, boolean gender) {
		super();
		this.name = name;
		this.age = age;
		this.gender = gender;
	}

}

class Company2 {
	private String name;

	public Company2(String name) {
		super();
		this.name = name;
	}

}

class Employee extends Person4 {
	private double salary;
	private Company2 company;
	
	public Employee(String name, int age, boolean gender, double salary, Company2 company) {
		super(name, age, gender);
		this.salary = salary;
		this.company = company;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Employee other = (Employee) obj;
		DecimalFormat df = new DecimalFormat("#.##");
		if (company == null) {
			if (other.company != null)
				return false;
			else
				return true;
		} else if (!company.equals(other.company))
			return false;
		if (!df.format(salary).equals(df.format(other.salary)))
			return false;
		return true;
	}

}

public class CoverEquals {
	
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		Company2 c1 = new Company2(in.next());
		Company2 c2 = new Company2(in.next());
		Person4 e1 = new Employee(in.next(),in.nextInt(),in.nextBoolean(),in.nextDouble(),c1);
		Person4 e2 = new Employee(in.next(),in.nextInt(),in.nextBoolean(),in.nextDouble(),c1);
		Person4 e3 = new Employee(in.next(),in.nextInt(),in.nextBoolean(),in.nextDouble(),c2);
		Person4 e4 = new Employee(in.next(),in.nextInt(),in.nextBoolean(),in.nextDouble(),c2);
		Person4 e5 = new Employee(in.next(),in.nextInt(),in.nextBoolean(),in.nextDouble(),c2);
		Person4 e6 = new Employee(in.next(),in.nextInt(),in.nextBoolean(),in.nextDouble(),null);
		System.out.println(e1.equals(e2));
		System.out.println(e1.equals(e3));
		System.out.println(e3.equals(e4));
		System.out.println(e3.equals(e5));
		System.out.println(e5.equals(e6));
		in.close();
	}
}
